package com.lagou.app;

import com.lagou.dao.EmployeeDao;
import com.lagou.entity.Employee;
import org.junit.Test;

import java.sql.SQLException;
import java.util.List;

public class TestEmployeeDao {
    //获取employee对象
    EmployeeDao employeeDao = new EmployeeDao();

    //查询所有员工信息
    @Test
    public void testGetAllEmployeeWithDept() throws SQLException {
        List<Employee> allEmployeeWithDept = employeeDao.getAllEmployeeWithDept();
        for (Employee employee : allEmployeeWithDept) {
            System.out.println(employee);
        }
    }
    //查询每个员工的 姓名, 薪资 和 所属部门名称
    @Test
    public void testGetAllEmployee() throws SQLException {
        List<Employee> allEmployee = employeeDao.getAllEmployee();
        for (Employee employee : allEmployee) {
            System.out.println("姓名： " + employee.getName() + ", 薪资： " + employee.getSalary()
            + ", 部门： " + employee.getDept());
        }
    }
}
